﻿using System.Drawing;
using System.Windows.Forms;

namespace RPG1
{
    class Monster : Role
    {
        public Monster(string name, int originalLife, int currentLife, int damage,
            PictureBox picBox, Label bottomLabel, Label topLabel)
            : base(name, originalLife, currentLife, damage, picBox, bottomLabel, topLabel)
        {
            //继承自父类的属性
            Name = name;
            OriginalLife = originalLife;
            CurrentLife = currentLife;
            Damage = damage;
            PicBox = picBox;
            BottomLabel = bottomLabel;
            TopLabel = topLabel;
        }


        //攻击力，防御力，伤害值（范围），原始生命值，当前生命值，原始位置，当前位置......

        public void move(Hero hero)
        {
            // 移动到英雄面前
            int diffX = hero.PicBox.Location.X - PicBox.Location.X - PicBox.Width;
            int diffY = hero.PicBox.Location.Y - PicBox.Location.Y;

            for (int i = 1; i <= 10; i++)
            {
                PicBox.Location = new Point(OriginaLocation.X + diffX * i / 10,
                   OriginaLocation.Y + diffY * i / 10);
                BottomLabel.Location = PicBox.Location;
                TopLabel.Location = PicBox.Location;
                Delay();
            }
            move();
        }
        public void died() {
            TopLabel.Dispose();
            BottomLabel.Dispose();
            PicBox.Dispose();
        }
    }
}